package com.pratices.cookie.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
public class Response6 {

   /* {"errno":0,"data":{"id":4,"key":"kkcdfnps5jczq7wxic95.jpg",
    "name":"zhaopian.jpg","type":"image/jpeg","size":119000,
    "url":"http://39.101.189.16:8083/wx/storage/fetch/kkcdfnps5jczq7wxic95.jpg",
   "addTime":"2025-04-29 20:29:46","updateTime":
    "2025-04-29 20:29:46"},"errmsg":"成功"}*/
    //新建个的类，用来封装返回的json数据
    public static class ResponseData {
        public int errno;
        public Data data;
        public String errmsg;
    }
    public static class Data {
        public int id;
        public String key;
        public String name;
        public String type;
        public int size;
        public String url;
        public String addTime;
        public String updateTime;

    }
    //成功的返回
    public static ResponseData success(Data data) {
        ResponseData responseData = new ResponseData();
        responseData.errno = 0;
        responseData.data = data;
        responseData.errmsg = "成功";
        return responseData;
    }
    //失败的返回
    public static ResponseData fail(int errno,String errmsg) {
        ResponseData responseData = new ResponseData();
        responseData.errno = errno;
        responseData.errmsg = errmsg;
        return responseData;
    }
}
